package com.hzncc.scaffold.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.hzncc.scaffold.entity.Bo.GetTrainerListBo;
import com.hzncc.scaffold.entity.Other.Trainerapply;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 培训师申请表 Mapper 接口
 * </p>
 *
 * @author DrunkBear
 * @since 2022-04-27
 */
public interface TrainerapplyMapper extends BaseMapper<Trainerapply> {

    @Select("SELECT\n" +
            "\t`trainerapply`.`id`,\n" +
            "\t`trainerapply`.`pubTime`,\n" +
            "\t`trainerapply`.`status`,\n" +
            "\t`trainerapply`.`attachFile`,\n" +
            "\t`trainerapply`.`createTime`,\n" +
            "\t`creator`.`id` AS `creatorId`,\n" +
            "\t`creator`.`name` AS `creatorName`,\n" +
            "\t`creator`.`account` AS `creatorAccount`,\n" +
            "\t`creator`.`realname` AS `creatorRealname`,\n" +
            "\t`creator`.`instituteName` AS `creatorInstituteName`,\n" +
            "\t`creator`.`idCardNum` AS `creatorIdCardNum`,\n" +
            "\t`creator`.`telephone` AS `creatorTelephone`,\n" +
            "\t`creator`.`gender` AS `creatorGender`,\n" +
            "\t`publisher`.`id` AS `publisherId`,\n" +
            "\t`publisher`.`name` AS `publisherName` \n" +
            "FROM\n" +
            "\t`trainerapply` AS `trainerapply`\n" +
            "\tLEFT OUTER JOIN `user` AS `creator` ON `trainerapply`.`userId` = `creator`.`id`\n" +
            "\tLEFT OUTER JOIN `user` AS `publisher` ON `trainerapply`.`publisherId` = `publisher`.`id` ${ew.customSqlSegment}")
    public List<GetTrainerListBo> getListBo(@Param(Constants.WRAPPER) QueryWrapper queryWrapper);

}
